// component/datetime-picker/index.js
Component({
  properties: {
    fixed: {
      type: '',
      value: false
    },
    startDate: {
      type: String,
      value: ''
    },
    endDate: {
      type: String,
      value: ''
    }
  },
  data: {
    image:'',
    startDate: '',
    endDate: ''
  },
  ready(){
    this.setData({
      startDate: this.properties.startDate,
      endDate: this.properties.endDate
    })
  },
  methods: {
    bindDateChange(e){
      const param = e.currentTarget.dataset.param
      const value = e.detail.value
      this.setData({
        [param]: value
      })
      this.triggerEvent('change', [this.data.startDate,this.data.endDate])
    },
    handleClear(e){
      const param = e.currentTarget.dataset.param
      this.setData({
        [param]: ''
      })
      this.triggerEvent('change', [this.data.startDate, this.data.endDate])
    }
  }
})
